var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            if (cm.getNumberFromQuestCustomData(40617) > 0) {
                cm.playerMessage(5, "已经完成了这里的任务。");
                cm.playerMessage(-1, "已经完成了这里的任务。");
                cm.dispose()
            } else {
                cm.sendNormalTalk("#b(从巨大沙漏中召唤出了时间之力。)", 33, cm.getNpc(), false, true)
            }
        } else {
            if (status === a++) {
                cm.forceStartQuest(40617, "1");
                cm.spawnMobLimit(9300796, 1, 2488, 158, 100);
                cm.playerMessage(5, "时间的流逝变成怪物的模样跳了出来。击退怪物吧。");
                cm.playerMessage(-1, "时间的流逝变成怪物的模样跳了出来。击退怪物吧。");
                cm.dispose()
            }
        }
    }
};